package com.lxl.settings.dao;

import com.lxl.commons.utils.DbUtil;

import javax.servlet.jsp.jstl.sql.Result;
import java.sql.SQLException;

/**
 * @author 北上寻海
 */
public class StaffDaoImpl implements StaffDao {


    @Override
    public Result judgePermissionsCommon(String id) throws SQLException {
        String sql = "select  id,staff_name,gender,phone,user_id,permissions from tbl_common_staff where user_id = ?";
        return DbUtil.select(sql,id);
    }

    @Override
    public Result judgePermissionsCurator(String id) throws SQLException {
        String sql = "select  id,staff_name,gender,phone,email,user_id,permissions from tbl_curator where user_id = ?";
        return DbUtil.select(sql,id);
    }

    @Override
    public Result judgePermissionsCategory(String id) throws SQLException {
        String sql = "select  s.id,s.staff_name,s.gender,s.phone,c.book_type as manage_type,s.permissions,s.user_id from tbl_category_staff s join tbl_category c on s.manage_type = c.id  where s.user_id = ?";
        return DbUtil.select(sql,id);
    }

    @Override
    public Result judgePermissionsAdministrator(String id) throws SQLException {
        String sql = "select  id,staff_name,permissions,user_id,phone,email from tbl_administrator where user_id = ?";
        return DbUtil.select(sql,id);
    }
}
